#include <iostream>
#include <vector>

using namespace std;

int removeDuplicates(vector<int>& nums) {
    int count = 0;
    for(int i = 1; i < nums.size(); i++){
        if(nums[i] == nums[i-1]) count++;
        else nums[i-count] = nums[i];
    }
    return nums.size() -count;
}

int main()
{
    vector<int> V = {0,0,1,1,1,2,2,3,3,4};
    int len = removeDuplicates(V);
    for (int i = 0; i < len; i++)
    {
        cout << V[i] << ' ';
    }
    cout << endl;
    return 0;
}